package easy;

import util.PrintUtils;

public class Solution_806 {

    public int[] numberOfLines(int[] widths, String s) {
        char[] chars = s.toCharArray();
        int count = 0, row = 1;
        for (char c : chars) {
            int w = widths[c - 'a'];
            int sum = count + w;
            if (sum > 100) {
                row++;
                count = w;
            } else {
                count = sum;
            }
        }
        return new int[]{row, count};
    }

    public static void main(String[] args) {
        Solution_806 model = new Solution_806();
        PrintUtils.arrayInt(model.numberOfLines(
            new int[]{10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
                10, 10}, "abcdefghijklmnopqrstuvwxyz"));
        PrintUtils.arrayInt(model.numberOfLines(
            new int[]{4, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
                10}, "bbbcccdddaaa"));

        PrintUtils.arrayInt(model.numberOfLines(
            new int[]{3, 4, 10, 4, 8, 7, 3, 3, 4, 9, 8, 2, 9, 6, 2, 8, 4, 9, 9, 10, 2, 4, 9, 10, 8, 2},
            "mqblbtpvicqhbrejb"));
    }
}
